/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * AdminPageFinal.java
 *
 * Created on 07 18, 12, 1:39:04 PM
 */
package Display;

import javax.swing.JOptionPane;

/**
 *
 * @author Aeron
 */
public class AdminPageFinal extends javax.swing.JFrame {

    /** Creates new form AdminPageFinal */
    public AdminPageFinal() {
        initComponents();
        this.setSize(700,490);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel3 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        send = new javax.swing.JButton();
        remove = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        touser = new javax.swing.JComboBox();
        jScrollPane3 = new javax.swing.JScrollPane();
        reminderfield = new javax.swing.JTextArea();
        section = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        reminderList = new javax.swing.JTable();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        jPanel3 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        removefees = new javax.swing.JButton();
        regborrowbook = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        endisresidency = new javax.swing.JToggleButton();
        jScrollPane5 = new javax.swing.JScrollPane();
        membertable = new javax.swing.JTable();
        residencylogs = new javax.swing.JButton();
        librarylogs = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jLabel3.setBackground(new java.awt.Color(255, 255, 255));
        jLabel3.setFont(new java.awt.Font("Garamond", 1, 24)); // NOI18N
        jLabel3.setText("Administrator Page");
        getContentPane().add(jLabel3);
        jLabel3.setBounds(480, 20, 200, 40);

        jTabbedPane1.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N

        jPanel2.setLayout(null);

        send.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        send.setText("Send Reminder");
        jPanel2.add(send);
        send.setBounds(366, 260, 140, 30);

        remove.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        remove.setText("Remove Reminder");
        remove.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeActionPerformed(evt);
            }
        });
        jPanel2.add(remove);
        remove.setBounds(510, 260, 140, 30);

        jLabel5.setFont(new java.awt.Font("Garamond", 1, 18)); // NOI18N
        jLabel5.setForeground(new java.awt.Color(255, 255, 255));
        jLabel5.setText("To:");
        jPanel2.add(jLabel5);
        jLabel5.setBounds(10, 34, 34, 14);

        touser.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        touser.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        touser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                touserActionPerformed(evt);
            }
        });
        jPanel2.add(touser);
        touser.setBounds(40, 27, 200, 30);

        reminderfield.setColumns(20);
        reminderfield.setRows(5);
        jScrollPane3.setViewportView(reminderfield);

        jPanel2.add(jScrollPane3);
        jScrollPane3.setBounds(20, 70, 340, 240);

        section.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        section.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jPanel2.add(section);
        section.setBounds(320, 27, 80, 30);

        jLabel8.setFont(new java.awt.Font("Garamond", 1, 18)); // NOI18N
        jLabel8.setForeground(new java.awt.Color(255, 255, 255));
        jLabel8.setText("Section :");
        jLabel8.setToolTipText("");
        jPanel2.add(jLabel8);
        jLabel8.setBounds(248, 30, 70, 20);

        reminderList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "Reminder"
            }
        ));
        jScrollPane6.setViewportView(reminderList);

        jPanel2.add(jScrollPane6);
        jScrollPane6.setBounds(420, 30, 210, 220);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/MalateBG.E-res.jpg"))); // NOI18N
        jPanel2.add(jLabel4);
        jLabel4.setBounds(0, -20, 660, 360);

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane7.setViewportView(jTable2);

        jPanel2.add(jScrollPane7);
        jScrollPane7.setBounds(80, 20, 452, 402);

        jTabbedPane1.addTab("Reminders", jPanel2);

        jPanel3.setLayout(null);

        jLabel7.setFont(new java.awt.Font("Garamond", 1, 20)); // NOI18N
        jLabel7.setForeground(new java.awt.Color(255, 255, 255));
        jLabel7.setText("Members");
        jPanel3.add(jLabel7);
        jLabel7.setBounds(140, 60, 90, 24);

        removefees.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        removefees.setText("Remove Fees");
        removefees.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removefeesActionPerformed(evt);
            }
        });
        jPanel3.add(removefees);
        removefees.setBounds(435, 130, 120, 35);

        regborrowbook.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        regborrowbook.setText("Register Borrowed Book");
        jPanel3.add(regborrowbook);
        regborrowbook.setBounds(410, 80, 170, 40);

        jButton7.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        jButton7.setText("Go to Library");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });
        jPanel3.add(jButton7);
        jButton7.setBounds(250, 33, 110, 35);

        endisresidency.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        endisresidency.setText("Enable/Disable Residency");
        endisresidency.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                endisresidencyActionPerformed(evt);
            }
        });
        jPanel3.add(endisresidency);
        endisresidency.setBounds(390, 30, 200, 40);

        membertable.setFont(new java.awt.Font("Garamond", 0, 12)); // NOI18N
        membertable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {"", null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "ID Number", "Name", "Section", "Overdue Fee"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane5.setViewportView(membertable);

        jPanel3.add(jScrollPane5);
        jScrollPane5.setBounds(20, 90, 320, 230);

        residencylogs.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        residencylogs.setText("View Residency Logs");
        residencylogs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                residencylogsActionPerformed(evt);
            }
        });
        jPanel3.add(residencylogs);
        residencylogs.setBounds(400, 210, 180, 25);

        librarylogs.setFont(new java.awt.Font("Garamond", 0, 14)); // NOI18N
        librarylogs.setText("View Library Logs");
        librarylogs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                librarylogsActionPerformed(evt);
            }
        });
        jPanel3.add(librarylogs);
        librarylogs.setBounds(400, 260, 180, 25);

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/MalateBG.E-res.jpg"))); // NOI18N
        jPanel3.add(jLabel6);
        jLabel6.setBounds(0, 0, 650, 350);

        jTabbedPane1.addTab("Others", jPanel3);

        getContentPane().add(jTabbedPane1);
        jTabbedPane1.setBounds(20, 80, 660, 370);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/MLFbgWhite1.jpg"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 690, 570);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void librarylogsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_librarylogsActionPerformed
        // TODO add your handling code here:

        this.setVisible(false);
        new LogsPageFinal().setVisible(true);
    }//GEN-LAST:event_librarylogsActionPerformed

    private void residencylogsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_residencylogsActionPerformed

        // TODO add your handling code here:
        this.setVisible(false);
        new LogsPageFinal().setVisible(true);

    }//GEN-LAST:event_residencylogsActionPerformed

    private void endisresidencyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_endisresidencyActionPerformed
        // TODO add your handling code here:
        //check if has selected value in the table
        // inassume ko na 1 member per action lng
        String getmember = "";
        int row = membertable.getSelectedRow();

        getmember = (String) membertable.getValueAt(row, 2);

        if (getmember == null) {
            JOptionPane.showMessageDialog(null, "No Selection.");
        } else {
            //database part
        }

    }//GEN-LAST:event_endisresidencyActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        // TODO add your handling code here:
        this.setVisible(false);
        new BookListsPageFinal().setVisible(true);
    }//GEN-LAST:event_jButton7ActionPerformed

    private void removefeesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removefeesActionPerformed
        // TODO add your handling code here:
        //check if has selected value in the table
        // inassume ko na 1 member per action lng
        String getmember = "";
        int row = membertable.getSelectedRow();

        getmember = (String) membertable.getValueAt(row, 2);

        if (getmember == null) {
            JOptionPane.showMessageDialog(null, "No Selection.");
        } else {
            //database part
        }
    }//GEN-LAST:event_removefeesActionPerformed

    private void touserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_touserActionPerformed
// TODO add your handling code here:
    }//GEN-LAST:event_touserActionPerformed

    private void removeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeActionPerformed
        // TODO add your handling code here:
        //check if reminderlist has selected value
        ;
        if (reminderList.getSelectedRow() == -1) {
            JOptionPane.showMessageDialog(null, "No Selection.");
        } else {
            //database part
            //if success
            JOptionPane.showMessageDialog(null, "Reminder removed.");

            //if fail
            JOptionPane.showMessageDialog(null, "Reminder not removed.");
        }

    }//GEN-LAST:event_removeActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(AdminPageFinal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(AdminPageFinal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(AdminPageFinal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(AdminPageFinal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new AdminPageFinal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToggleButton endisresidency;
    private javax.swing.JButton jButton7;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable2;
    private javax.swing.JButton librarylogs;
    private javax.swing.JTable membertable;
    private javax.swing.JButton regborrowbook;
    private javax.swing.JTable reminderList;
    private javax.swing.JTextArea reminderfield;
    private javax.swing.JButton remove;
    private javax.swing.JButton removefees;
    private javax.swing.JButton residencylogs;
    private javax.swing.JComboBox section;
    private javax.swing.JButton send;
    private javax.swing.JComboBox touser;
    // End of variables declaration//GEN-END:variables
}
